
<%@ page import="auctionhaus.Listing;auctionhaus.Bid"%>
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName"
	value="${message(code: 'listing.label', default: 'Listing')}" />
<title><g:message code="default.detail.label"
		args="[listingInstance?.name]" /></title>
<g:javascript library="jquery" />

<g:javascript>
        window.onload = load();
        window.onload = startMinBidAjaxRequests();
        

</g:javascript>



<script type="text/javascript">


function getLatestMaxBid()
{
    $(document).ready(function() {
    	  $(window).keydown(function(event){
    	    if(event.keyCode == 13) {
    	      event.preventDefault();
    	      return false;
    	    }
    	  });
    	});
	
	<g:remoteFunction action="currentMinimumBid" 
		controller="listing" update="minBid" params="['listing.id':"${listingInstance.id}"]"/>
		
	
}

function startMinBidAjaxRequests()
{

	var interval; // make sure that is defined outside of the loaded div content
	$(document).ready(function () {
	    if (typeof interval != "number"){
	         interval = setInterval(function () {
	        	 getLatestMaxBid();
	  }, 5000);
	    }
	});
		
	
}


function load()
{
	<g:remoteFunction action="saveBidAndReturnDetailsAjax" 
		controller="bid" update="detailView" params="['listing.id':"${listingInstance.id}",'listingLoad':'true']"/>


		
}
</script>
</head>
<body>
	<a href="#show-listing" class="skip" tabindex="-1"><g:message
			code="default.link.skip.label" default="Skip to content&hellip;" /></a>
	<div class="nav" role="navigation">
		<ul>
			<li><a class="home" href="${createLink(uri: '/')}"><g:message
						code="default.home.label" /></a></li>
		
			<li><g:link class="create" action="create">
					<g:message code="default.new.label" args="[entityName]" />
				</g:link></li>
		</ul>
	</div>
	
	
	<div id="detailView"></div>



</body>
</html>
